package com.itheima.service.impl;

import com.itheima.domain.City;
import com.itheima.mapper.CityMapper;
import com.itheima.mapper.ProductMapper;
import com.itheima.service.CityService;
import com.itheima.util.MapperUtil;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class CityServiceImp implements CityService {
    @Override
    public List<City> findAll() {
        SqlSession session = MapperUtil.getSession();
       CityMapper mapper = session.getMapper(CityMapper.class);
        List<City> list=mapper.findAll();
        return list;
    }
    @Override
    public City findByName( String name){
        SqlSession session = MapperUtil.getSession();
        CityMapper mapper = session.getMapper(CityMapper.class);
       City city= mapper.findByName(name);
       return city;
    }
    @Override
    public City findById(String id) {
        SqlSession session = MapperUtil.getSession();
        CityMapper mapper = session.getMapper(CityMapper.class);
       City city= mapper.findById(id);
       return city;
    }
}
